/*
 * @Author: yangni 920556271@qq.com
 * @Date: 2023-12-07 09:26:03
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2023-12-26 17:22:02
 * @FilePath: /yt-devops/lib/model/device_obj/spec/array_spec.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:json_annotation/json_annotation.dart';
import 'package:yt_devops/model/device_obj/data_type_model.dart';
import 'package:yt_devops/model/device_obj/output_data_model.dart';

part 'array_spec.g.dart';

@JsonSerializable()
class ArraySpec {
  int? size;
  DataTypeModel? item;
  String? aliseRule;

  ArraySpec({this.size, this.item, this.aliseRule});

  factory ArraySpec.fromJson(Map<String, dynamic> json) =>
      _$ArraySpecFromJson(json);

  Map<String, dynamic> toJson() => _$ArraySpecToJson(this);
}

class ArrayItemModel {
  DataTypeEnum type;
  Object specs;

  ArrayItemModel({required this.type, required this.specs});

  factory ArrayItemModel.fromJson(Map<String, dynamic> json) => ArrayItemModel(
      specs: json['specs'],
      type: $enumDecode($DataTypeEnumEnumMap, json['type']));
}
